package com.dkm.biz.gl.repository.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.gl.domain.EavValueDecimal;
import com.dkm.biz.gl.persistence.dao.EavValueDecimalQueryDao;
import com.dkm.biz.gl.persistence.entity.EavValueDecimalPo;
import com.dkm.biz.gl.repository.EavValueDecimalRepository;
import com.dkm.biz.repository.AbstractRepository;

/**
 * 对象功能:属性值浮点 Repository接口的实现类
 * 开发公司:SKG.COM
 * 开发人员:Yuki
 * 创建时间:2014-12-19 10:24:27
 */
@Repository
public class EavValueDecimalRepositoryImpl extends AbstractRepository<String, EavValueDecimalPo,EavValueDecimal> implements EavValueDecimalRepository{
	  
	@Resource
	private  EavValueDecimalQueryDao eavValueDecimalQueryDao;

	public EavValueDecimal newInstance() {
		EavValueDecimalPo po = new EavValueDecimalPo();
		EavValueDecimal eavValueDecimal = SpringHelper.getBean(EavValueDecimal.class);
		eavValueDecimal.setData(po);
		return eavValueDecimal;
	}

	public EavValueDecimal newInstance(EavValueDecimalPo po) {
		EavValueDecimal eavValueDecimal = SpringHelper.getBean(EavValueDecimal.class);
		eavValueDecimal.setData(po);
		return eavValueDecimal;
	} 
	
	@Override
	protected IQueryDao<String, EavValueDecimalPo> getQueryDao() {
		return eavValueDecimalQueryDao;
	}
	public EavValueDecimalPo findByProdAttr(String entityId, String attrId){
		 Map<String,Object> params=new HashMap<String,Object>();
			params.put("entityId",entityId);
			params.put("attrId", attrId);
			return eavValueDecimalQueryDao.getByKey("findByProdAttr", params);
	}
	@Override
	public List<EavValueDecimalPo> findAllByEntityId(String entityId) {
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("whereSql"," entity_id_='"+entityId+"'");
		return  eavValueDecimalQueryDao.findAll(params);
	}
}
